<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
      /* 
    一.对象的创建方式
        1.构造函数创建
        2.字面量的形式创建
        3.new Object()的方式创建创建
    二.属性的调用
       2.1 对象名.属性
       2.2 对象名【‘属性’】
    三.方法的调用
       3.1 对象名.方法名()   
     */
      //一.构造函数创建
      var Student = new Object();
      console.log(Student);
      Student.name = "jason";
      Student.age = 20;
      Student.like = function (hobby) {
        console.log("我叫" + this.name + "年龄" + this.age + "喜欢" + hobby);
      }
      //Student.like("钓鱼"); 
      console.log(Student.name); //jason
      console.log(Student.color); //undefined

      //二.字面量的形式创建
      var Teacher = {
        name: "老王",
        age: 40,
        like: function (hobby) {
          console.log("我叫" + this.name + "年龄" + this.age + "喜欢" + hobby);
        }
      }
      Teacher.like("教书");
      console.log(Teacher);

      //三.利用new Object()的方式创建
      var obj = new Object();
      obj.name = 'pink';
      onj.age = 18;
      obj.teach = function () {
        console.log("教前端");
      }
    </script>
  </head>

  <body>

  </body>

</html>